<?php
	chong_pha_hoai();
?>
<form action="" method="post" enctype="multipart/form-data">
<center>
	<table width="990px" border="0">
	  <tr>
		<td><b>Loại sản phẩm:</b></td>
		<td>
			<?php
				function xac_dinh_menu_con_123($id_cha)
			   	{
					$tv="select count(*) from loaisp where thuoc_id_loaisp='$id_cha'";
				  	$tv_1=mysql_query($tv);
				  	$tv_2=mysql_fetch_row($tv_1);
				  	if($tv_2==0)
				  	{
					 	return "no";
				  	}
				  	else
				  	{
					 	return "yes";
				  	}
			   }
			   
			   function de_quy_menu_fff($id_cha,$kt="")
			   {
					$kt=$kt."&nbsp;&nbsp;|--";
				  	$tv="select * from loaisp where (thuoc_id_loaisp='$id_cha')";
				  	$tv_1=mysql_query($tv);
				  	while($tv_2=mysql_fetch_array($tv_1))
				  	{
						echo"<option>";
							echo $kt;
							echo $tv_2['ten_loaisp'];
							echo "&nbsp;";
						echo"</option>";
						$xac_dinh_menu_con_123=xac_dinh_menu_con_123($tv_2['id_loaisp']);
						if($xac_dinh_menu_con_123=="yes")
						{								
							de_quy_menu_fff($tv_2['id_loaisp']);
						}
					}
			   }
			?>
			<?php
				echo "<select name='id_loaisp'>";
						$tv="select * from loaisp where thuoc_id_loaisp=0";
						$tv_1=mysql_query($tv);
						while($tv_2=mysql_fetch_array($tv_1))
						{
							echo"<option>";
									echo $tv_2['ten_loaisp'];
							echo"</option>";
							$xac_dinh_menu_con_123=xac_dinh_menu_con_123($tv_2['id_loaisp']);
							if($xac_dinh_menu_con_123=="yes")
							{
								de_quy_menu_fff($tv_2['id_loaisp']);
							}
						}
				echo "</select>";
			?>
		</td>
	  </tr>
	  <tr>
		<td><b>Tên:</b></td>
		<td>
			<input size="70" name="ten_sanpham">
		</td>
	  </tr>
	  <tr>
		<td><b>Hình ảnh:</b></td>
		<td>
			<input type="file" name="hinh">
		</td>
	  </tr>
	  <tr>
		<td><b>Giá:</b></td>
		<td>
			<input size="70" name="gia">
		
		</td>
	  </tr>
	  <tr>
		<td colspan="2">
			<center><b>Nội dung:</b></center>
			<br>
			<center>
				<script type="text/javascript">
					var oFCKeditor = new FCKeditor('FCKeditor1') ;
					oFCKeditor.BasePath	= "fckeditor/" ;
					oFCKeditor.Height	= 300 ;
					oFCKeditor.Width	= 800 ;
					oFCKeditor.Value	= 'noi dung' ;
					oFCKeditor.Config ["EnterMode"] = "br" ;
					oFCKeditor.Create() ;
				</script>
			</center>
		</td>
	  </tr>
	  <tr>
		<td>&nbsp;</td>
		<td>
			<input type="hidden" name="them_sanpham" value="them_sanpham">
			<input type="submit" value="Thêm">
		</td>
	  </tr>
	</table>
</center>
</form>
